<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        let obj = {
            name: "张三",
            age: 18,
            gender: "男",
            skill: ["吃", "喝", "玩", "乐"]
        }
        // let { name: a, age: b, gender: c, skill: d } = obj
        // console.log(a,b,c,d)
        let {name,age,gender,skill}=obj;
        console.log(name,age,gender,skill); //完全解构

        //不完全解构
        // let{name:a,age:b,gender:c}=obj;
        // console.log(a,b,c);

        //设置缺省值
        let{name:a1,age:b1,skill:c1}=obj;
        console.log(a1,b1,c1);

        // 设置解构默认值
        let{name:a,age:b=20,gender:c}=obj;
        console.log(a,b,c);
    </script>
</body>
</html>